home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 272_01 / mktone.doc < prev    next >
Text File  |  1986-09-23  |  2KB  |  39 lines

  1.  
  2.  
  3.        NAME
  4.                mktone -- make a tone to the speaker
  5.  
  6.        SYNOPSIS
  7.                #include "sound.h"
  8.                void mktone(freq, update, delay);
  9.                int freq;       frequency of tone
  10.                int update      speaker control command
  11.                int delay       value to delay before returning
  12.  
  13.        DESCRIPTION
  14.        This is a very simple function to make a tone on the IBM speaker
  15.        using the standard timer controller.  The frequency is an integer
  16.        which increases the pitch of the tone with decreasing values.
  17.        the delay is an integer which is used in a very simple "for" loop
  18.        to control duration of the tone.  A value of 0 is no delay.
  19.        The update integer is defined in sound.h as follows:
  20.               if update == UPDATE  just send frequency and delay
  21.               if update == TOGGLE  turn sound off after delay is complete
  22.               else  turn sound on and leave it on when returning
  23.        Any tone may be turned off by setting freq to 0.  In this case,
  24.        update and delay values are ignored and may be set to any value.
  25.  
  26.        EXAMPLE
  27.              #include "sound.h"
  28.              mktone(1000, TOGGLE, 1000);  /* make a short beep */
  29.  
  30.              mktone(1000, ON, 0);         /* turn a tone on */
  31.              mktone(0, 0, 0);             /* turn a tone off */
  32.  
  33.              mktone(2000, ON, 0);         /* turn a tone on */
  34.              mktone(1000, UPDATE, 0);     /* raise the pitch */
  35.              mktone(0, 0, 0);             /* turn it off */
  36.  
  37.  
  38.        This function is found in SMDLx.LIB for the Datalight Compiler.
  39.